package com.conncui.common.json.impl;

import com.conncui.common.json.dao.Json;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.List;

/**
 * Created by cui on 16-3-1.
 */
public class OrgJsonImpl implements Json {
    String TAG = this.getClass().getSimpleName();

    @Override
    public String objectToString(Object object) {
        return null;
    }

    @Override
    public <T> T stringToObject(String jsonString, Class<T> tClass) {
        return null;
    }

    @Override
    public <T> List<T> stringToObjectList(String jsonString, Class<T> tClass) {
        try {
            JSONObject jsonObject = new JSONObject(jsonString);
            System.out.println(TAG+","+jsonObject.length());
            int i = 0;
            while (jsonObject.keys().hasNext()) {
                System.out.println(TAG+","+(++i));
                System.out.println(TAG+","+jsonObject.get(jsonObject.keys().next()).toString());
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public String objectListToString(Object objectList) {
        return null;
    }
}